<?php

namespace project\common;

use Monolog\Logger;
use Monolog\Handler\AbstractProcessingHandler;

class MonologHandlerRedis extends AbstractProcessingHandler
{

    /**
     * @param int $level
     * @param bool $bubble 多个handler将不会处理
     */
    public function __construct(int $level = Logger::ERROR, bool $bubble = true)
    {
        parent::__construct($level, $bubble);
    }

    public function isHandling(array $record): bool
    {
        return $record['level'] == $this->level;
    }

    protected function write(array $record): void
    {
        // TODO: Implement write() method.
        var_dump("redis write");
    }
}